package fastas3
{
	
	public class FastAttr
	{
		private static const ATTR:FastAttr = new FastAttr(null, null);
		
		internal var name:String;
		internal var owner:FastObject;
		
		internal static function createAttr(owner:FastObject, name:String):FastAttr {
			ATTR.name = name;
			ATTR.owner = owner;
			return ATTR;
		}
		
		public function FastAttr(owner:FastObject, name:String) {
			this.owner = owner;
			this.name = name;
		}
		
		public function get():Object {
			return owner._getAttr(name);
		}
		
		public function getNum():Number {
			return Number(owner.getAttr(name));
		}
		
		public function set(value:Object):FastObject {
			return owner._setAttr(name, value);
		}
		
		public function add(value:Object):FastObject {
			return owner._addAttr(name, value);
		}
		
		public function save():FastObject {
			return owner._saveAttr(name);
		}
		
		public function load():Object {
			return owner._loadAttr(name);
		}
		
		public function loadNum():Number {
			return Number(owner._loadAttr(name));
		}
		
		public function restore():FastObject {
			return owner._restoreAttr(name);
		}
	}
}